//go:build wireinject

package main

import (
	"github.com/gin-gonic/gin"
	"github.com/google/wire"
	"jk-webook/internal/repository"
	"jk-webook/internal/repository/cache"
	"jk-webook/internal/repository/dao"
	"jk-webook/internal/service"
	"jk-webook/internal/web"
)

var thirdProvider = wire.NewSet(InitRedis, InitDb)
var userSvcProvider = wire.NewSet(
	dao.NewUserDao, cache.NewUserCache,
	repository.NewUserRepository,
	service.NewUserService,
	web.NewUserHandler,
)

func InitWebServer() *gin.Engine {
	wire.Build(thirdProvider, userSvcProvider,
		cache.NewCodeCache,
		repository.NewCodeRepository,
		service.NewCodeService,
		InitGin,
		InitMiddlewares,
	)
	return new(gin.Engine)
}

//func InitWebServer() *gin.Engine {
//	wire.Build(InitDb, InitRedis,
//		dao.NewUserDao, cache.NewUserCache,
//		cache.NewCodeCache,
//		repository.NewUserRepository,
//		repository.NewCodeRepository,
//		service.NewUserService,
//		service.NewCodeService,
//		tencent.NewSmsService,
//		web.NewUserHandler,
//		InitGin,
//		InitMiddlewares,
//	)
//	return new(gin.Engine)
//}
